package com.wuzheng.wisgo.sanitation.cloud.controller.gis;


import com.wuzheng.wisgo.sanitation.cloud.repository.entity.gis.MapBase;
import com.wuzheng.wisgo.sanitation.cloud.service.gis.MapBaseService;
import com.wuzheng.wisgo.sanitation.framework.base.controller.BaseController;
import com.wuzheng.wisgo.sanitation.framework.core.protocol.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author：sp
 * @date：Created in 2019-10-16
 * @description：经纬度转换控制器
 * @modified By：
 * @version: 1.0
 */
@RestController
@RequestMapping("/mapBase")
@Api(value = "MapBaseCtrl", tags = "经纬度转换接口")
public class MapBaseCtrl extends BaseController {

    @Autowired
    private MapBaseService mapBaseService;

    /**
     * 获取经纬度转换列表
     */
    @PostMapping(value = "/list")
    @ApiOperation(value = "获取经纬度转换列表")
    public Result<List<MapBase>> list() {
        return this.success(mapBaseService.selectList());
    }

    /**
     * 新增经纬度转换
     */
    @PostMapping(value = "/add")
    @ApiOperation(value = "新增经纬度转换")
    public Result<String> add(MapBase mapBase) {
        mapBaseService.insert(mapBase);
        return this.success();
    }

    /**
     * 删除经纬度转换
     */
    @PostMapping(value = "/delete/{id}")
    @ApiOperation(value = "删除经纬度转换")
    public Result<String> delete(@PathVariable("id") Long id) {
        mapBaseService.deleteById(id);
        return this.success();
    }

    /**
     * 修改经纬度转换
     */
    @PostMapping(value = "/update")
    @ApiOperation(value = "修改经纬度转换")
    public Result<String> update(MapBase mapBase) {
        mapBaseService.updateById(mapBase);
        return this.success();
    }

    /**
     * 获取经纬度转换
     */
    @GetMapping(value = "/get/{id}")
    @ApiOperation(value = "获取经纬度转换")
    public Result<MapBase> get(@PathVariable("id") Long id) {
        return this.success(mapBaseService.selectById(id));
    }
}

